#include "exportdialog.h"

ExportDialog::ExportDialog(TypeOfExport typeOfExport, QWidget *parent) :
    QDialog(parent)
{
    setupUi(this);

    type = typeOfExport;

    connect( findPath_button, SIGNAL(pressed()), SLOT(findPathForExport()));
}

void ExportDialog::findPathForExport()
{
    if( type == ExportToFolder)
        exportTo_field->setText( QFileDialog::getExistingDirectory(this, "Выберите путь для сохранения", QDir::homePath()));
    else if ( type == ExportToArchive)
        exportTo_field->setText( QFileDialog::getSaveFileName(this, "Выберите путь для сохранения", QDir::homePath(), "Формат архиватора FreeArc (.arc)"));
    else
        exportTo_field->setText( QFileDialog::getSaveFileName(this, "Выберите путь для сохранения", QDir::homePath(), "Самораспаковывающийся архив (.arc)"));
    startButton->setDisabled( exportTo_field->text().isEmpty() );
}
